// RVO : return value optimization
// disable with -fno-elide-constructors in g++
//
#include <iostream>

class T
{
public:
	T() { std::cout << "T()" << std::endl; }
	~T() { std::cout << "~T()" << std::endl; }

	T( const T &t ) { std::cout << "T(T&t)" << std::endl; }
	const T &operator = ( const T &t ) { std::cout << "operator=" << std::endl; return *this; }

	void print( void ) { std::cout << "----------------" << std::endl; }
};

T f( T t )
{
	t.print();

	return t;
}

int main( int argc, char *argv[] )
{
	T t;

	std::cout << "========================" << std::endl;
	T b = f( t );
	std::cout << "========================" << std::endl;
	return 0;
}

